import { View, Text, Input, Textarea } from '@tarojs/components';
import styles from '../index.less';
import { Common } from './Common';

const DietTab = ({ formData, setFormData }: any) => {
  return (
    <View>
      <View className={styles.formItem}>
        <Text className={styles.label}>名称</Text>
        <Input
          className={styles.input}
          placeholder="请输入食物名称"
          value={formData.title}
          onInput={(e) => setFormData((prev: any) => ({ ...prev, title: e.detail.value }))}
        />
      </View>
      <Common formData={formData} setFormData={setFormData} />
      <View className={styles.formItem}>
        <Text className={styles.label}>描述</Text>
        <Textarea
          className={styles.input}
          placeholder="请输入食物描述"
          value={formData.content}
          onInput={(e) => setFormData((prev: any) => ({ ...prev, content: e.detail.value }))}
        />
      </View>
    </View>
  );
};

export { DietTab };
